package com.spark.fqdemoshardingsphere.controller;


import com.spark.basecommon.api.R;
import com.spark.fqdemoshardingsphere.entity.PmsProduct;
import com.spark.fqdemoshardingsphere.service.IPmsProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 商品信息 前端控制器
 * </p>
 *
 * @author fuqiang
 * @since 2021-07-06
 */
@RestController
@RequestMapping("/fqdemoshardingsphere/pms-product")
public class PmsProductController {

    @Autowired
    private IPmsProductService pmsProductService;

    @GetMapping("/list")
    public R<List<PmsProduct>> getLists(){
        return R.success(pmsProductService.list());
    }

    @PostMapping("/save")
    public R<Boolean> save(){
        PmsProduct pp = new PmsProduct();
        pp.setAlbumPics("2");
        pp.setName("ceshi");
        pp.setProductSn("ddddd");
        pp.setDetailDesc("测试分表");
        return R.success(pmsProductService.save(pp));
    }
}
